/***********************************************************************************
Copy right:	    Coffee Tech.
Author:         jiaoyue
Date:           2021-12.1
Description:    随机数生成
***********************************************************************************/

#include <pub_define.h>
#include <time.h>
#include "random.h"

void set_really_random()
{
    srand((unsigned)time(NULL));
}

int random_int(int min, int max)
{
    return min + (rand()%max);
}

float random_float(float min, float max)
{
    return min + rand()/(float)(RAND_MAX/(max-min));
}

double random_double(double min, double max)
{
    return min + rand()/(double)(RAND_MAX/(max-min));
}


